<style>
  #bookSell-update {
    padding: 20px 25px 25px 0;
  }

  #bookSell-update .layui-treeSelect .ztree li a, .ztree li span {
    margin: 0 0 2px 3px !important;
  }
</style>
<div class="layui-fluid" id="bookSell-cart">
  <form class="layui-form" action="" lay-filter="bookSell-cart-form">
    <!--        <input type="hidden" name="id" data-th-value="${bookSell.id}">-->
    <div class="layui-form-item">
      <label class="layui-form-label febs-form-item-require">图书名称：</label>
      <div class="layui-input-block">
        <input type="text" name="bookname" minlength="1" maxlength="10" lay-verify="required"
               autocomplete="off" class="layui-input" readonly>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label febs-form-item-require">出版社：</label>
      <div class="layui-input-block">
        <input type="text" name="pubid" minlength="1" maxlength="10" lay-verify="required"
               autocomplete="off" class="layui-input" readonly>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label febs-form-item-require">价格：</label>
      <div class="layui-input-block">
        <input type="text" name="bookmoney" autocomplete="off" class="layui-input"
               lay-verify="required|number" readonly>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label febs-form-item-require">图书类型：</label>
      <div class="layui-input-block">
        <input type="text" name="type" autocomplete="off" class="layui-input"
               lay-verify="required" readonly>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label febs-form-item-require">书籍简介：</label>
      <div class="layui-input-block">
        <input type="text" name="message" autocomplete="off" class="layui-input"
               lay-verify="required" readonly>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label febs-form-item-require">选购数量：</label>
      <div class="layui-input-block">
        <input type="text" name="number" id="number" autocomplete="off" class="layui-input"
               lay-verify="required|number" placeholder="加入购物车的数量">
      </div>
    </div>
    <div class="layui-form-item febs-hide">
      <button class="layui-btn" lay-submit="" lay-filter="bookSell-cart-form-submit" id="submit"></button>
    </div>
  </form>
</div>

<script data-th-inline="javascript">
  layui.use(['febs', 'form', 'validate'], function () {
    var $ = layui.$,
        febs = layui.febs,
        layer = layui.layer,
        form = layui.form,
        bookSell = [[${bookSell}]],
        $view = $('#bookSell-cart'),
        validate = layui.validate;

    form.verify(validate);
    form.render();
    initbookSellValue();

    function initbookSellValue() {
      form.val("bookSell-cart-form", {
        // "id": bookSell.id,
        "bookname": bookSell.bookname,
        "message": bookSell.message,
        "pubid": bookSell.pubid,
        "bookmoney": bookSell.bookmoney,
        "type": bookSell.type
      });
    }

    form.on('submit(bookSell-cart-form-submit)', function (data) {
      data.field.number === $('#number').val;
      febs.post(ctx + 'bookSell/cart/', data.field, function () {
        layer.closeAll();
        febs.alert.success(data.field.number + '本' + bookSell.bookname + '，添加购物车成功');
        $('#febs-bookSell').find('#query').click();
      });
      return false;
    });
  });
</script>